**********************************************************************************	
*** TABLE A10: Dynamic Effect of Other Moderators on IP Rate.
**********************************************************************************
			
use "$DATALOC/AgencyLevel.dta", clear
* Total number of witnesses.
eststo app_a3_1: reghdfe iprate agen_hear_all last_agen_hear agen_nwitness_all lXagen_nwitness_last_hr,  a(agency FY)
	quietly estadd local fixedyear "Yes", replace
	quietly estadd local fixedagency "Yes", replace
	estadd ysumm, replace	
* Number of AGENCY political appointee witnesses. 
eststo app_a3_2: reghdfe iprate agen_hear_all last_agen_hear agen_polappt_all lXagen_polappt_last_hr,  a(agency FY)
	quietly estadd local fixedyear "Yes", replace
	quietly estadd local fixedagency "Yes", replace
	estadd ysumm, replace	
* Subcommittee hearings
eststo app_a3_3: reghdfe iprate agen_hear_all last_agen_hear agen_subcom_all lXagen_subcom_last_hr,  a(agency FY)
	quietly estadd local fixedyear "Yes", replace
	quietly estadd local fixedagency "Yes", replace
	estadd ysumm, replace	
* Election year timing
eststo app_a3_4: reghdfe iprate agen_hear_all last_agen_hear agen_electionp_all lXagen_electionp_last_hr,  a(agency FY)
	quietly estadd local fixedyear "Yes", replace
	quietly estadd local fixedagency "Yes", replace
	estadd ysumm, replace
* Check if election year effect is driven by 2012
* all IP hearings in election year 2012 happened during fiscal year 2012
drop if FY==2012
eststo app_a3_5: reghdfe iprate agen_hear_all last_agen_hear agen_electionp_all lXagen_electionp_last_hr,  a(agency FY)
	quietly estadd local fixedyear "Yes", replace
	quietly estadd local fixedagency "Yes", replace
	estadd ysumm, replace	
	
use "$DATALOC/ProgramLevel.dta", clear
* Total number of witnesses.
eststo app_p3_1: reghdfe iprate agen_hear_all last_agen_hear agen_nwitness_all lXagen_nwitness_last_hr,  a(programname FY) $CLUSTERCODE
	quietly estadd local fixedyear "Yes", replace
	quietly estadd local fixedagency "Yes", replace
	estadd ysumm, replace	
* Number of AGENCY political appointee witnesses. 
eststo app_p3_2: reghdfe iprate agen_hear_all last_agen_hear agen_polappt_all lXagen_polappt_last_hr,  a(programname FY) $CLUSTERCODE
	quietly estadd local fixedyear "Yes", replace
	quietly estadd local fixedagency "Yes", replace
	estadd ysumm, replace	
* Subcommittee hearing
eststo app_p3_3: reghdfe iprate agen_hear_all last_agen_hear agen_subcom_all lXagen_subcom_last_hr,  a(programname FY) $CLUSTERCODE
	quietly estadd local fixedyear "Yes", replace
	quietly estadd local fixedagency "Yes", replace
	estadd ysumm, replace
* Election year timing
eststo app_p3_4: reghdfe iprate agen_hear_all last_agen_hear agen_electionp_all lXagen_electionp_last_hr,  a(programname FY) $CLUSTERCODE
	quietly estadd local fixedyear "Yes", replace
	quietly estadd local fixedagency "Yes", replace
	estadd ysumm, replace
* Check if election year effect is driven by 2012
* all IP hearings in election year 2012 happened during fiscal year 2012
drop if FY==2012
eststo app_p3_5: reghdfe iprate agen_hear_all last_agen_hear agen_electionp_all lXagen_electionp_last_hr,  a(agency FY)
	quietly estadd local fixedyear "Yes", replace
	quietly estadd local fixedagency "Yes", replace
	estadd ysumm, replace	
		
	
*** OUTPUT TABLE	
* One panel, agency and program level together
esttab app_a3_1 app_a3_2 app_a3_3 app_a3_4 app_a3_5 app_p3_1 app_p3_2 app_p3_3 app_p3_4 app_p3_5 using "$TABLELOC/TableA10.tex", ///
	prehead("\begin{sidewaystable}[htbp]\centering \def\sym#1{\ifmmode^{#1}\else\(^{#1}\)\fi} \caption{Dynamic Effect of Other Moderators on Improper Payment Rate.} \resizebox{\textwidth}{!}{ \begin{tabular}{l*{11}{c}} \toprule") ///
	b(a2) fragment ///
	booktabs label se star(** 0.05 *** 0.01)s(fixedyear fixedagency N, label("Fiscal Year FE" "Agency/Program FE" "Observations")) ///
	order(last_agen_hear lXagen_nwitness_last_hr lXagen_polappt_last_hr lXagen_subcom_last_hr lXagen_electionp_last_hr agen_hear_all) keep(last* lX* agen*) ///
	nomtitles ///
	mgroups("Agency-level" "Program-level", ///
				pattern(1 0 0 0 0 0 1 0 0 0 0 0) ///
				span prefix(\multicolumn{@span}{l}{) suffix(})) ///
	prefoot("\hline") ///
	postfoot("\bottomrule \multicolumn{10}{l}{Standard errors in parentheses; clustered on agency-year for program-level analysis.} \\ \multicolumn{10}{l}{Columns (1)-(5) are agency-level specifications; columns (6)-(10) are program-level specifications.} \\ \multicolumn{10}{l}{Columns (5) and (10) exclude fiscal year 2012, when all improper payments hearings were held during election year 2012.}\\ \multicolumn{4}{l}{\footnotesize \sym{**} \(p<0.05\), \sym{***} \(p<0.01\)}\\ \end{tabular} } \\ \label{tab:othermoderatorsdyn} \end{sidewaystable}") replace
	
	

